/* 
 * File:   nametable.h
 * Author: ScaV
 *
 * Created on October 26, 2011, 5:17 PM
 */

#ifndef NAMETABLE_H
#define	NAMETABLE_H

#define HASHTABLE_DEBUG

#include <vector>
#include "scanner.h"

class nametable {
public:
	nametable(int size);
	nametable(const nametable& orig);
	virtual ~nametable();
	
	int add(lexeme* lx);
	bool print(const char *name);
	std::vector<char>* operator [] (int i) { return table[i]; };
	long getSize() { return size; };
	
private:
	long size;
	long fill;
	static const int multiple = 2;
	int resizes;
	
	int *depth;
	long **index;
	unsigned *Rand8;
	std::vector<char> **table;
	
	void resize();
	int hash(int num, std::vector<char> *str);
};

#endif	/* NAMETABLE_H */

